package com.forusers.dyntyp.client;

import java.util.ArrayList;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;

public class EffectBase {
	FlexTable table = new FlexTable();
	Button nextButton = new Button("Next");
	Button prevButton = new Button("Prev");
	int index;
	ArrayList<String> words = new ArrayList<String>();
	
	class ArrowClickHandler implements ClickHandler  {
		@Override
		public void onClick(ClickEvent event) {
			if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_RIGHT) {
				next();
			}
			if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_LEFT) {
				prev();
			}
		}
	}

	public void applyEffect() {
	}
	
	void next() {
		if (index <= words.size() - 1) {
			++index;
		}
		applyEffect();
	}
	
	void prev() {
		if (index > 0) {
			--index;
		}
		applyEffect();
	}
}
